package com.houfukude.Activity;

import com.houfukude.Utils.ActionBar_Utils;
import com.houfukude.Utils.FTP_Client;
import com.houfukude.Utils.SetFragmentView;
import com.houfukude.xtestmgr.R;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.Toast;

public class FtpActivity extends ActionBarActivity {
	private String DEBUG_TAG = "FtpActivity";
	private LinearLayout ftp_layout;
	private FTP_Client ftp_Client;
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.fragment_file);
		ScrollView download_sv = (ScrollView)findViewById(R.id.download_sv);
		ftp_layout = (LinearLayout) download_sv.findViewById(R.id.download_list);
		ftp_Client = new FTP_Client();
	}
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.ftp_menu, menu);
		String mTitle = getString(R.string.title_section1);
		ActionBar_Utils.restoreActionBar(mTitle, getSupportActionBar());
		return super.onCreateOptionsMenu(menu);
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		Log.d(DEBUG_TAG, "ItemSelected item.getItemId():" + item.getItemId());
		switch (item.getItemId()) {
		/**
		 * ftp_menu.xml
		 */
		case R.id.action_refresh:
			ActionBar_Utils.RefreshItemSelected(item, this);
			break;
		case R.id.action_server:
			ActionBar_Utils.ServerItemSelected(item, this);
			break;
		case R.id.action_openap:
			ActionBar_Utils.OpenapItemSelected(item, this);
			break;
		case R.id.action_openwifi:
			ActionBar_Utils.OpenwifiItemSelected(item, this);
			break;
		case R.id.action_settings:
			Toast.makeText(this, "settings for " + getTitle(),
					Toast.LENGTH_SHORT).show();
			break;
		}
		return super.onOptionsItemSelected(item);
	}
}
